<template>
  <div class="active">
    <el-button class="cheaback" type="text" icon="el-icon-back" @click="hback"
      >返回</el-button
    >
    <el-form>
      <el-image
        style="width: 170px; height: 170px"
        :src="itemform.avatar"
      ></el-image>
      <ul>
        <li>用户ID:{{ this.itemform.userId }}</li>
        <li>昵称:{{ this.itemform.nick }}</li>
        <li>性别：{{ this.sd }}</li>
        <li v-if="this.itemform.birthday !== null">生日:{{ this.itemform.birthday.year+"-"+this.itemform.birthday.month + '-' +this.itemform.birthday.day }}</li>
        <li v-else>生日:</li>
        <li v-if="this.itemform.address == null">城市:</li>
        <li v-else-if="this.itemform.address.province == ''">城市:</li>
        <li v-else>城市:{{ this.itemform.address.province+'-' + this.itemform.address.city+"-" + this.itemform.address.county || ''}}</li>
      </ul>
      <ul class="chonget">
        <li>个性签名:{{ this.itemform.signature }}</li>
        <li>注册时间:{{ this.itemform.status }}</li>
      </ul>
    </el-form>
  </div>
</template>

<script>
import sex from './sex'
export default {
  data() {
    return {
        sd:'',
      itemform: {
        userId:'',
        avatar:'',
        nick:'',
        sex:'',
        birthday:{},
        address:{},
        signature:'',
        status:''
      },
    };
  },
  created() {
    this.loachier();
  },
  methods: {
    async loachier() {
      this.itemform = this.$route.query.row;
        // console.log(this.itemform);
      //  判断男女
      this.sd = sex(this.itemform.sex)

      var ctay=JSON.parse(this.itemform.address)
      this.itemform.address=ctay
      console.log(this.itemform.address);
      // 生日
       
      this.itemform.birthday=JSON.parse(this.itemform.birthday)
      // console.log(this.itemform.birthday);
    },
    hback() {
      this.$router.back();
    },
 
  },
};
</script>

<style scoped>
.active{
  background-color: #fff;
}
.el-image {
  margin: 50px 50px;
}
ul {
  display: inline-block;
  margin-right: 100px;
}
li {
  margin-bottom: 30px;
  list-style: none;
  font-size: 14px;
}
.chonget {
  transform: translateY(-60%);
}
</style>
